﻿<Window x:Class="Snipps.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification"
        xmlns:AttachedProperties="clr-namespace:Snipps.Infrastructure.AttachedProperties"
        xmlns:Behaviors="clr-namespace:Snipps.Infrastructure.Behaviors" xmlns:Langs="clr-namespace:Snipps.Langs"
        xmlns:Controls="clr-namespace:Snipps.Controls" xmlns:ViewModels="clr-namespace:Snipps.ViewModels"
        Title="MainWindow"
        Width="887"
        Height="443"
        AttachedProperties:WindowCustomizer.CanMaximize="False"
        Background="{StaticResource BackgroundBrush}"
        BorderBrush="{StaticResource ForegroundBrush}"
        BorderThickness="{StaticResource BorderThickness}"
        DataContext="{Binding MainViewModel,
                              Source={StaticResource Locator}}"
        ResizeMode="CanResizeWithGrip"
        ShowInTaskbar="False">

    <i:Interaction.Behaviors>
        <Behaviors:BorderlessWindowBehavior />
    </i:Interaction.Behaviors>

    <Window.Resources>
        <ResourceDictionary>

            <ContextMenu x:Key="trayMenu">
                <MenuItem Command="{Binding CloseCommand}"
                          Header="Exit" />
            </ContextMenu>
        </ResourceDictionary>
    </Window.Resources>


    <Grid Margin="6">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <tb:TaskbarIcon ContextMenu="{StaticResource trayMenu}"
                        IconSource="/Resources/Images/Logo.ico"
                        LeftClickCommand="{Binding ToggleVisibilityCommand}"
                        MenuActivation="RightClick"
                        ToolTipText="{x:Static Langs:Lang.TraybarIconToolTipText}"
                        Visibility="Visible" />


        <DockPanel x:Name="PART_TitleBar"
                   Grid.Row="0"
                   Margin="0,4,0,10"
                   Background="Transparent"
                   LastChildFill="False">
            <TextBlock DockPanel.Dock="Left"
                       FontSize="{StaticResource TitleFontSize}"
                       Foreground="{StaticResource DisableBrush}">
                <TextBlock.Text>
                    <MultiBinding StringFormat="{}{0} &gt; {1}">
                        <Binding Mode="OneTime"
                                 Source="{x:Static Langs:Lang.MainWindowTitle}" />
                        <Binding FallbackValue=""
                                 Path="CurrentStatus" />
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
            <Controls:CloseButton Command="{x:Static ViewModels:WindowCommands.HideCommand}"
                                  DockPanel.Dock="Right"
                                  IsTabStop="False" />
        </DockPanel>

        <ContentPresenter Grid.Row="1"
                          Content="{Binding CurrentPage}" />

    </Grid>
</Window>